#ifndef BASE_EVENT_H_
#define BASE_EVENT_H_

#if defined(WIN32)
#include "win32.h"
#elif defined(POSIX)
#include <pthread.h>
#else
#error "Must define either WIN32 or POSIX."
#endif

namespace base
{
	class Event
	{
	public:
		Event(bool manual_reset, bool initially_signaled);
		~Event();

		void Set();
		void Reset();
		bool Wait(int cms);

	private:
		bool is_manual_reset_;

#if defined(WIN32)
		bool is_initially_signaled_;
		HANDLE event_handle_;
#elif defined(POSIX)
		bool event_status_;
		pthread_mutex_t event_mutex_;
		pthread_cond_t event_cond_;
#endif
	};
}

#endif	// BASE_EVENT_H_